package com.diploma.project.aiqiyi.utils;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Base64;

import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;

public class AesUtil {
	/**
	 * aes加密
	 * @param encodeRules  密钥规则
	 * @param content      待加密字符串
	 * @return
	 * @throws Exception
	 */
	@Deprecated
	public static String encodeByRule(String encodeRules, String content) throws Exception {
        return encode(content, generateKey(encodeRules));
    }

    /**
     * 根据规则生成128位  aeskey
     * @param encodeRules
     * @return
     * @throws NoSuchAlgorithmException
     */
    public static String generateKey(String encodeRules) throws NoSuchAlgorithmException {
        // 1.构造密钥生成器，指定为AES算法,不区分大小写
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
        secureRandom.setSeed(encodeRules.getBytes());
        // 2.根据ecnodeRules规则初始化密钥生成器
        // 生成一个128位的随机源,根据传入的字节数组
        keygen.init(128, secureRandom);
        // 3.产生原始对称密钥
        SecretKey original_key = keygen.generateKey();
        // 4.获得原始对称密钥的字节数组
        return Base64.getEncoder().encodeToString(original_key.getEncoded());
    }

    /**
     * 通过key来加密
     * @param content  明文
     * @param key     aes密钥的Base64编码
     * @return
     * @throws NoSuchAlgorithmException
     * @throws NoSuchPaddingException
     * @throws InvalidKeyException
     * @throws IllegalBlockSizeException
     * @throws BadPaddingException
     */
    public static String encode( String key,String content) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
        // 5.根据字节数组生成AES密钥
        SecretKey sKey = new SecretKeySpec(Base64.getDecoder().decode(key), "AES");
        // 6.根据指定算法AES自成密码器
        Cipher cipher = Cipher.getInstance("AES");
        // 7.初始化密码器，第一个参数为加密(Encrypt_mode)或者解密解密(Decrypt_mode)操作，第二个参数为使用的KEY
        cipher.init(Cipher.ENCRYPT_MODE, sKey);
        // 8.获取加密内容的字节数组(这里要设置为utf-8)不然内容中如果有中文和英文混合中文就会解密为乱码
        byte[] byte_encode = content.getBytes(StandardCharsets.UTF_8);
        // 9.根据密码器的初始化方式--加密：将数据加密
        byte[] byte_AES = cipher.doFinal(byte_encode);
        // 10.将加密后的数据转换为字符串
        return Base64.getEncoder().encodeToString(byte_AES);
    }

    /**
	 * aes解密
	 * @param encodeRules  密钥规则
	 * @param content      待解密字符串
	 * @return
	 * @throws Exception
	 */
    @Deprecated
	public static String decodeByRule(String encodeRules, String content) throws Exception {
		return decode(generateKey(encodeRules),content);
	}


    /**
     * 通过key来解密
     * @param key       密钥的base64编码
     * @param content   密文的base64编码
     * @return
     * @throws Exception
     */
	public static String decode(String key,String content) throws Exception{
        //4.获得原始对称密钥的字节数组
        byte[] raw = Base64.getDecoder().decode(key);
        //5.根据字节数组生成AES密钥
        SecretKey keySpec = new SecretKeySpec(raw, "AES");
        //6.根据指定算法AES自成密码器
        Cipher cipher = Cipher.getInstance("AES");
        //7.初始化密码器，第一个参数为加密(Encrypt_mode)或者解密(Decrypt_mode)操作，第二个参数为使用的KEY
        cipher.init(Cipher.DECRYPT_MODE, keySpec);
        //8.将加密并编码后的内容解码成字节数组
        byte[] byte_content = Base64.getDecoder().decode(content);
        /*
         * 解密
         */
        byte[] byte_decode = cipher.doFinal(byte_content);
        return new String(byte_decode, StandardCharsets.UTF_8);
    }

	public static void main(String[] args) throws Exception {

     /* List<JointHousing> jointHousingsList = new ArrayList<>();
        String jointHousingStr = "{\n" + "\t\"took\": 0,\n" + "\t\"timed_out\": false,\n" + "\t\"_shards\": {\n" + "\t\t\"total\": 5,\n" + "\t\t\"successful\": 5,\n" + "\t\t\"failed\": 0\n" + "\t},\n" + "\t\"hits\": {\n" + "\t\t\"total\": 9119,\n" + "\t\t\"max_score\": 1,\n" + "\t\t\"hits\": [{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"89\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 76,\n" + "\t\t\t\t\t\"store_name\": \"保利店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"九龙坡区\",\n" + "\t\t\t\t\t\"unit_name\": \"1\",\n" + "\t\t\t\t\t\"room_count\": 3,\n" + "\t\t\t\t\t\"door_number\": \"12-2\",\n" + "\t\t\t\t\t\"inside_space\": null,\n" + "\t\t\t\t\t\"house_code\": \"BL0001\",\n" + "\t\t\t\t\t\"building\": \"22\",\n" + "\t\t\t\t\t\"store_id\": 392,\n" + "\t\t\t\t\t\"id\": 89,\n" + "\t\t\t\t\t\"property_adrr_id\": 174,\n" + "\t\t\t\t\t\"property_adrr_name\": \"保利时代广场\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.266Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"149\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 160,\n" + "\t\t\t\t\t\"store_name\": \"黄泥磅店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"渝北区\",\n" + "\t\t\t\t\t\"unit_name\": \"\",\n" + "\t\t\t\t\t\"room_count\": 6,\n" + "\t\t\t\t\t\"door_number\": \"2011\",\n" + "\t\t\t\t\t\"inside_space\": 80,\n" + "\t\t\t\t\t\"house_code\": \"HNB0005\",\n" + "\t\t\t\t\t\"building\": \"1\",\n" + "\t\t\t\t\t\"store_id\": 540,\n" + "\t\t\t\t\t\"id\": 149,\n" + "\t\t\t\t\t\"property_adrr_id\": 358,\n" + "\t\t\t\t\t\"property_adrr_name\": \"天人居\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.284Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"99\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 152,\n" + "\t\t\t\t\t\"store_name\": \"大坪1店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"渝中区\",\n" + "\t\t\t\t\t\"unit_name\": \"6\",\n" + "\t\t\t\t\t\"room_count\": 0,\n" + "\t\t\t\t\t\"door_number\": \"6666\",\n" + "\t\t\t\t\t\"inside_space\": 56,\n" + "\t\t\t\t\t\"house_code\": \"S0004\",\n" + "\t\t\t\t\t\"building\": \"6\",\n" + "\t\t\t\t\t\"store_id\": 528,\n" + "\t\t\t\t\t\"id\": 99,\n" + "\t\t\t\t\t\"property_adrr_id\": 355,\n" + "\t\t\t\t\t\"property_adrr_name\": \"嘉华鑫城\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.269Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"120\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 76,\n" + "\t\t\t\t\t\"store_name\": \"航畅店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"九龙坡区\",\n" + "\t\t\t\t\t\"unit_name\": \"2\",\n" + "\t\t\t\t\t\"room_count\": 3,\n" + "\t\t\t\t\t\"door_number\": \"111\",\n" + "\t\t\t\t\t\"inside_space\": 12,\n" + "\t\t\t\t\t\"house_code\": \"HC0001\",\n" + "\t\t\t\t\t\"building\": \"2\",\n" + "\t\t\t\t\t\"store_id\": 496,\n" + "\t\t\t\t\t\"id\": 120,\n" + "\t\t\t\t\t\"property_adrr_id\": 174,\n" + "\t\t\t\t\t\"property_adrr_name\": \"保利时代广场\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.276Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"126\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 186,\n" + "\t\t\t\t\t\"store_name\": \"黄泥磅店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"渝北区\",\n" + "\t\t\t\t\t\"unit_name\": \"1\",\n" + "\t\t\t\t\t\"room_count\": 6,\n" + "\t\t\t\t\t\"door_number\": \"1008\",\n" + "\t\t\t\t\t\"inside_space\": 90,\n" + "\t\t\t\t\t\"house_code\": \"HNB0001\",\n" + "\t\t\t\t\t\"building\": \"1\",\n" + "\t\t\t\t\t\"store_id\": 633,\n" + "\t\t\t\t\t\"id\": 126,\n" + "\t\t\t\t\t\"property_adrr_id\": 367,\n" + "\t\t\t\t\t\"property_adrr_name\": \"天和居\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.278Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"129\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 165,\n" + "\t\t\t\t\t\"store_name\": \"大坪店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"渝中区\",\n" + "\t\t\t\t\t\"unit_name\": \"1\",\n" + "\t\t\t\t\t\"room_count\": 3,\n" + "\t\t\t\t\t\"door_number\": \"105\",\n" + "\t\t\t\t\t\"inside_space\": null,\n" + "\t\t\t\t\t\"house_code\": \"DP0003\",\n" + "\t\t\t\t\t\"building\": \"1\",\n" + "\t\t\t\t\t\"store_id\": 553,\n" + "\t\t\t\t\t\"id\": 129,\n" + "\t\t\t\t\t\"property_adrr_id\": 337,\n" + "\t\t\t\t\t\"property_adrr_name\": \"大坪茶亭\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.279Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"92\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 152,\n" + "\t\t\t\t\t\"store_name\": \"大坪1店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"渝中区\",\n" + "\t\t\t\t\t\"unit_name\": \"1\",\n" + "\t\t\t\t\t\"room_count\": 3,\n" + "\t\t\t\t\t\"door_number\": \"2008\",\n" + "\t\t\t\t\t\"inside_space\": null,\n" + "\t\t\t\t\t\"house_code\": \"S0003\",\n" + "\t\t\t\t\t\"building\": \"3\",\n" + "\t\t\t\t\t\"store_id\": 528,\n" + "\t\t\t\t\t\"id\": 92,\n" + "\t\t\t\t\t\"property_adrr_id\": 318,\n" + "\t\t\t\t\t\"property_adrr_name\": \"万科锦程\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.267Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"98\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 164,\n" + "\t\t\t\t\t\"store_name\": \"ZONG店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"渝中区\",\n" + "\t\t\t\t\t\"unit_name\": \"3\",\n" + "\t\t\t\t\t\"room_count\": 2,\n" + "\t\t\t\t\t\"door_number\": \"3\",\n" + "\t\t\t\t\t\"inside_space\": null,\n" + "\t\t\t\t\t\"house_code\": \"zb0003\",\n" + "\t\t\t\t\t\"building\": \"1\",\n" + "\t\t\t\t\t\"store_id\": 544,\n" + "\t\t\t\t\t\"id\": 98,\n" + "\t\t\t\t\t\"property_adrr_id\": 335,\n" + "\t\t\t\t\t\"property_adrr_name\": \"石油路-地铁站\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.269Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"105\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 160,\n" + "\t\t\t\t\t\"store_name\": \"黄泥磅店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"渝北区\",\n" + "\t\t\t\t\t\"unit_name\": \"\",\n" + "\t\t\t\t\t\"room_count\": 4,\n" + "\t\t\t\t\t\"door_number\": \"1005\",\n" + "\t\t\t\t\t\"inside_space\": 80,\n" + "\t\t\t\t\t\"house_code\": \"HNB0002\",\n" + "\t\t\t\t\t\"building\": \"1\",\n" + "\t\t\t\t\t\"store_id\": 540,\n" + "\t\t\t\t\t\"id\": 105,\n" + "\t\t\t\t\t\"property_adrr_id\": 330,\n" + "\t\t\t\t\t\"property_adrr_name\": \"天和居\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.271Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t{\n" + "\t\t\t\t\"_index\": \"bpm_qft_housing\",\n" + "\t\t\t\t\"_type\": \"joint_housing\",\n" + "\t\t\t\t\"_id\": \"108\",\n" + "\t\t\t\t\"_score\": 1,\n" + "\t\t\t\t\"_source\": {\n" + "\t\t\t\t\t\"area_id\": 159,\n" + "\t\t\t\t\t\"store_name\": \"九龙坡店\",\n" + "\t\t\t\t\t\"@version\": \"1\",\n" + "\t\t\t\t\t\"area_name\": \"九龙坡区\",\n" + "\t\t\t\t\t\"unit_name\": \"1\",\n" + "\t\t\t\t\t\"room_count\": 4,\n" + "\t\t\t\t\t\"door_number\": \"101\",\n" + "\t\t\t\t\t\"inside_space\": 130,\n" + "\t\t\t\t\t\"house_code\": \"JLP0001\",\n" + "\t\t\t\t\t\"building\": \"A\",\n" + "\t\t\t\t\t\"store_id\": 538,\n" + "\t\t\t\t\t\"id\": 108,\n" + "\t\t\t\t\t\"property_adrr_id\": 329,\n" + "\t\t\t\t\t\"property_adrr_name\": \"九龙花园\",\n" + "\t\t\t\t\t\"@timestamp\": \"2019-07-05T07:36:00.272Z\",\n" + "\t\t\t\t\t\"type\": \"joint_housing\"\n" + "\t\t\t\t}\n" + "\t\t\t}\n" + "\t\t]\n" + "\t}\n" + "}";
        ESResult jsonObject = GsonUtil.fromJson(jointHousingStr, ESResult.class);
        List<ESParentHits> esParentHitsList = new ArrayList<>();
       *//*   if (Objects.nonNull(jsonObject)) {
            ESHits esHits = jsonObject.getHits();
            if(Objects.nonNull(esHits)){
                esParentHitsList = esHits.getHits();
                if(CollectionUtils.isNotEmpty(esParentHitsList)){
                    for(ESParentHits esParentHits:esParentHitsList){
                        Map<String ,Object > map = esParentHits.get_source();
                        JointHousing jointHousing =EntityUtils.mapToEntity(map,JointHousing.class);
                        jointHousingsList.add(jointHousing);
                    }
                }
            }
        }
        jointHousingsList.forEach(jointHousing -> {
            System.out.println(jointHousing.getArea_name()+""+jointHousing.getType());
        });
        System.out.println(jointHousingsList.size());*//*
        System.out.println("----------------------------------------------------------------------------");

        List<WholeHousing> wholeHousingList = new ArrayList<>();
        String wholeHousingStr = "{\n" + "  \"took\": 1,\n" + "  \"timed_out\": false,\n" + "  \"_shards\": {\n" + "    \"total\": 5,\n" + "    \"successful\": 5,\n" + "    \"failed\": 0\n" + "  },\n" + "  \"hits\": {\n" + "    \"total\": 15847,\n" + "    \"max_score\": 1,\n" + "    \"hits\": [\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11235\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1090,\n" + "          \"store_name\": \"恒大店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"朝阳区\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"HD0086\",\n" + "          \"door_number\": \"310\",\n" + "          \"inside_space\": 53,\n" + "          \"building\": \"6\",\n" + "          \"store_id\": 1401,\n" + "          \"id\": 11235,\n" + "          \"property_adrr_id\": 7631,\n" + "          \"property_adrr_name\": \"恒大领寓\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.655Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11246\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1129,\n" + "          \"store_name\": \"宋家庄店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"丰台区\",\n" + "          \"unit_name\": \"1\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"WJSZ0001\",\n" + "          \"door_number\": \"202\",\n" + "          \"inside_space\": 88.72,\n" + "          \"building\": \"1\",\n" + "          \"store_id\": 1441,\n" + "          \"id\": 11246,\n" + "          \"property_adrr_id\": 7936,\n" + "          \"property_adrr_name\": \"顶秀金颐家园\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.662Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11254\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1098,\n" + "          \"store_name\": \"天润二店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"大东区\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"te2039\",\n" + "          \"door_number\": \"2108\",\n" + "          \"inside_space\": null,\n" + "          \"building\": \"2\",\n" + "          \"store_id\": 1410,\n" + "          \"id\": 11254,\n" + "          \"property_adrr_id\": 7698,\n" + "          \"property_adrr_name\": \"天润广场\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.668Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11255\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 874,\n" + "          \"store_name\": \"北花园2店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"朝阳区\",\n" + "          \"unit_name\": \"1\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"W0121\",\n" + "          \"door_number\": \"0503\",\n" + "          \"inside_space\": 80,\n" + "          \"building\": \"13\",\n" + "          \"store_id\": 1275,\n" + "          \"id\": 11255,\n" + "          \"property_adrr_id\": 7574,\n" + "          \"property_adrr_name\": \"福润四季-a区\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.668Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11261\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1098,\n" + "          \"store_name\": \"天润二店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"大东区\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"te4274\",\n" + "          \"door_number\": \"1614\",\n" + "          \"inside_space\": null,\n" + "          \"building\": \"6\",\n" + "          \"store_id\": 1410,\n" + "          \"id\": 11261,\n" + "          \"property_adrr_id\": 7698,\n" + "          \"property_adrr_name\": \"天润广场\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.672Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11263\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1098,\n" + "          \"store_name\": \"大悦城店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"大东区\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"d3146\",\n" + "          \"door_number\": \"1412\",\n" + "          \"inside_space\": 40,\n" + "          \"building\": \"6\",\n" + "          \"store_id\": 1408,\n" + "          \"id\": 11263,\n" + "          \"property_adrr_id\": 7698,\n" + "          \"property_adrr_name\": \"天润广场\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.673Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11266\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1100,\n" + "          \"store_name\": \"总部店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"江干区\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"z0002\",\n" + "          \"door_number\": \"436\",\n" + "          \"inside_space\": 34,\n" + "          \"building\": \"5\",\n" + "          \"store_id\": 1429,\n" + "          \"id\": 11266,\n" + "          \"property_adrr_id\": 7820,\n" + "          \"property_adrr_name\": \"恒祺克拉天玺\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.675Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11267\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1098,\n" + "          \"store_name\": \"天润二店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"大东区\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"te3020\",\n" + "          \"door_number\": \"2214\",\n" + "          \"inside_space\": null,\n" + "          \"building\": \"3\",\n" + "          \"store_id\": 1410,\n" + "          \"id\": 11267,\n" + "          \"property_adrr_id\": 7698,\n" + "          \"property_adrr_name\": \"天润广场\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.675Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11268\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1130,\n" + "          \"store_name\": \"松山湖店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"东莞市\",\n" + "          \"unit_name\": \"1\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"ZB0002\",\n" + "          \"door_number\": \"1604\",\n" + "          \"inside_space\": 89,\n" + "          \"building\": \"5\",\n" + "          \"store_id\": 1398,\n" + "          \"id\": 11268,\n" + "          \"property_adrr_id\": 7941,\n" + "          \"property_adrr_name\": \"星城翠珑湾\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.676Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"whole_housing\",\n" + "        \"_id\": \"11274\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 1098,\n" + "          \"store_name\": \"天润二店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"大东区\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 1,\n" + "          \"house_code\": \"te3040\",\n" + "          \"door_number\": \"1011\",\n" + "          \"inside_space\": null,\n" + "          \"building\": \"4\",\n" + "          \"store_id\": 1410,\n" + "          \"id\": 11274,\n" + "          \"property_adrr_id\": 7698,\n" + "          \"property_adrr_name\": \"天润广场\",\n" + "          \"@timestamp\": \"2019-07-05T08:52:16.680Z\",\n" + "          \"type\": \"whole_housing\"\n" + "        }\n" + "      }\n" + "    ]\n" + "  }\n" + "}";
        ESResult jsonObjectWholeHousing = GsonUtil.fromJson(wholeHousingStr, ESResult.class);
        if (Objects.nonNull(jsonObjectWholeHousing)) {
            ESHits esHits = jsonObjectWholeHousing.getHits();
            if(Objects.nonNull(esHits)){
                esParentHitsList = esHits.getHits();
                if(CollectionUtils.isNotEmpty(esParentHitsList)){
                    for(ESParentHits esParentHits:esParentHitsList){
                        Map<String ,Object > map = esParentHits.get_source();
                        WholeHousing wholeHousing =EntityUtils.mapToEntity(map,WholeHousing.class);
                        wholeHousingList.add(wholeHousing);
                    }
                }
            }
        }
        wholeHousingList.forEach(wholeHousing -> {
            System.out.println(wholeHousing.getType());
        });




        System.out.println("----------------------------------------------------------------------------");

        List<FocusHousing> focusHousingList = new ArrayList<>();
        String focusHousingStr = "{\n" + "  \"took\": 0,\n" + "  \"timed_out\": false,\n" + "  \"_shards\": {\n" + "    \"total\": 5,\n" + "    \"successful\": 5,\n" + "    \"failed\": 0\n" + "  },\n" + "  \"hits\": {\n" + "    \"total\": 751,\n" + "    \"max_score\": 1,\n" + "    \"hits\": [\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1032\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 162,\n" + "          \"store_name\": \"春熙路店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"锦江区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 0,\n" + "          \"house_code\": \"CXLCXL0006\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.624Z\",\n" + "          \"building\": \"3\",\n" + "          \"store_id\": 542,\n" + "          \"id\": 1032,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1033\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 182,\n" + "          \"store_name\": \"总部\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"锦江区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"A\",\n" + "          \"room_count\": 6,\n" + "          \"house_code\": \"ZBZB0004\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.624Z\",\n" + "          \"building\": \"A\",\n" + "          \"store_id\": 607,\n" + "          \"id\": 1033,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1035\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 161,\n" + "          \"store_name\": \"黄泥磅店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"江北区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 3,\n" + "          \"house_code\": \"HNBHNB0004\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.625Z\",\n" + "          \"building\": \"2\",\n" + "          \"store_id\": 540,\n" + "          \"id\": 1035,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1036\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 76,\n" + "          \"store_name\": \"保利店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"九龙坡区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 0,\n" + "          \"focus_type_name\": \"自持\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 4,\n" + "          \"house_code\": \"BLBL2630\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.626Z\",\n" + "          \"building\": \"1\",\n" + "          \"store_id\": 392,\n" + "          \"id\": 1036,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1082\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 142,\n" + "          \"store_name\": \"CA店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"渝中区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 13,\n" + "          \"house_code\": \"CACA0007\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.684Z\",\n" + "          \"building\": \"\",\n" + "          \"store_id\": 506,\n" + "          \"id\": 1082,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1084\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 76,\n" + "          \"store_name\": \"金茂店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"九龙坡区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"\",\n" + "          \"room_count\": 20,\n" + "          \"house_code\": \"JMJM0002\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.745Z\",\n" + "          \"building\": \"\",\n" + "          \"store_id\": 657,\n" + "          \"id\": 1084,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1087\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 197,\n" + "          \"store_name\": \"总部\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"渝中区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"1\",\n" + "          \"room_count\": 2,\n" + "          \"house_code\": \"SSSS0001\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.746Z\",\n" + "          \"building\": \"1\",\n" + "          \"store_id\": 585,\n" + "          \"id\": 1087,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1089\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 197,\n" + "          \"store_name\": \"总部\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"渝中区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"2\",\n" + "          \"room_count\": 7,\n" + "          \"house_code\": \"SSSS0003\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.747Z\",\n" + "          \"building\": \"1\",\n" + "          \"store_id\": 585,\n" + "          \"id\": 1089,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1099\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 183,\n" + "          \"store_name\": \"南岸店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"南岸区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"1\",\n" + "          \"room_count\": 6,\n" + "          \"house_code\": \"CXLCXL0005\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.750Z\",\n" + "          \"building\": \"A\",\n" + "          \"store_id\": 609,\n" + "          \"id\": 1099,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"focus_housing\",\n" + "        \"_id\": \"1102\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"area_id\": 183,\n" + "          \"store_name\": \"南岸店\",\n" + "          \"@version\": \"1\",\n" + "          \"area_name\": \"南岸区\",\n" + "          \"after_audit_status_name\": \"通过\",\n" + "          \"focus_type\": 1,\n" + "          \"focus_type_name\": \"租赁\",\n" + "          \"unit_name\": \"1\",\n" + "          \"room_count\": 6,\n" + "          \"house_code\": \"CXLCXL0006\",\n" + "          \"after_audit_status\": 1,\n" + "          \"@timestamp\": \"2019-07-05T09:01:00.751Z\",\n" + "          \"building\": \"A\",\n" + "          \"store_id\": 609,\n" + "          \"id\": 1102,\n" + "          \"type\": \"focus_housing\"\n" + "        }\n" + "      }\n" + "    ]\n" + "  }\n" + "}";
        ESResult jsonObjectFocusHousing = GsonUtil.fromJson(focusHousingStr, ESResult.class);
        if (Objects.nonNull(jsonObjectFocusHousing)) {
            ESHits esHits = jsonObjectFocusHousing.getHits();
            if(Objects.nonNull(esHits)){
                esParentHitsList = esHits.getHits();
                if(CollectionUtils.isNotEmpty(esParentHitsList)){
                    for(ESParentHits esParentHits:esParentHitsList){
                        Map<String ,Object > map = esParentHits.get_source();
                        FocusHousing focusHousing =EntityUtils.mapToEntity(map,FocusHousing.class);
                        focusHousingList.add(focusHousing);
                    }
                }
            }
        }
        focusHousingList.forEach(focusHousing -> {
            System.out.println(focusHousing.getType());
        });

        System.out.println("----------------------------------------------------------------------------");

        List<JointRoom> jointRoomList = new ArrayList<>();
        String jointRoomStr = "{\n" + "  \"took\": 1,\n" + "  \"timed_out\": false,\n" + "  \"_shards\": {\n" + "    \"total\": 5,\n" + "    \"successful\": 5,\n" + "    \"failed\": 0\n" + "  },\n" + "  \"hits\": {\n" + "    \"total\": 33987,\n" + "    \"max_score\": 1,\n" + "    \"hits\": [\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3007\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"dxzb18344\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.434Z\",\n" + "          \"room_number\": \"E\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3007,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3011\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"dxzb18508\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.434Z\",\n" + "          \"room_number\": \"C\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3011,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3014\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"dxzb17427\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.435Z\",\n" + "          \"room_number\": \"A\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3014,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3019\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"QS0031\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.435Z\",\n" + "          \"room_number\": \" C\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3019,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3021\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"dxzb17231\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.436Z\",\n" + "          \"room_number\": \"B\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3021,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3027\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"未租\",\n" + "          \"house_code\": \"QS0032\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.446Z\",\n" + "          \"room_number\": \" A\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3027,\n" + "          \"is_lease\": 0\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3030\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"未租\",\n" + "          \"house_code\": \"QS0032\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.446Z\",\n" + "          \"room_number\": \" D\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3030,\n" + "          \"is_lease\": 0\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3038\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"dxzb18343\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.447Z\",\n" + "          \"room_number\": \"B\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3038,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3041\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"dxzb17232\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.447Z\",\n" + "          \"room_number\": \"A\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3041,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      },\n" + "      {\n" + "        \"_index\": \"bpm_qft_housing\",\n" + "        \"_type\": \"joint_room\",\n" + "        \"_id\": \"3043\",\n" + "        \"_score\": 1,\n" + "        \"_source\": {\n" + "          \"lease_status\": \"已租\",\n" + "          \"house_code\": \"dxzb17232\",\n" + "          \"@version\": \"1\",\n" + "          \"@timestamp\": \"2019-07-05T09:12:02.448Z\",\n" + "          \"room_number\": \"C\",\n" + "          \"type\": \"joint_room\",\n" + "          \"id\": 3043,\n" + "          \"is_lease\": 1\n" + "        }\n" + "      }\n" + "    ]\n" + "  }\n" + "}";
        ESResult jsonObjectJointRoom = GsonUtil.fromJson(jointRoomStr, ESResult.class);
        if (Objects.nonNull(jsonObjectJointRoom)) {
            ESHits esHits = jsonObjectJointRoom.getHits();
            if(Objects.nonNull(esHits)){
                esParentHitsList = esHits.getHits();
                if(CollectionUtils.isNotEmpty(esParentHitsList)){
                    for(ESParentHits esParentHits:esParentHitsList){
                        Map<String ,Object > map = esParentHits.get_source();
                        JointRoom jointRoom =EntityUtils.mapToEntity(map,JointRoom.class);
                        jointRoomList.add(jointRoom);
                    }
                }
            }
        }
        jointRoomList.forEach(jointRoom -> {
            System.out.println(jointRoom.getType());
        });
*/
	}





}
